package com.yunyan.controller;


import com.yunyan.entity.ResourceData;
import com.yunyan.resp.JsonResp;
import com.yunyan.service.ResourceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


// 首页公告资源
@RestController
@RequestMapping("/resource")
public class ResourceController {


    @Resource
    private ResourceService resourceService;


    @GetMapping("/list")
    public JsonResp list(){
        return JsonResp.ok(resourceService.list());
    }


    @PostMapping
    public JsonResp saveResource(@RequestBody ResourceData resourceData){
        return JsonResp.ok(resourceService.save(resourceData));
    }
}
